package qz_rpt

class PreInMessageController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }

    def preInMessage(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]

        params.SYS_QUERY_NAME = 'preInMessage'
        def preInMessage = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'preInMsgType'
        def preInMsgType = dynamicQueryService.queryForList(params)
        println(preInMessage)
        def tableHeadList =  []
        if(preInMessage.size()>0){
            tableHeadList =  preInMessage[0].keySet()
        }
        params.SYS_QUERY_NAME = 'preInMessageCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        params.SYS_QUERY_NAME = 'preInMsgPrendId'
        def preInMsgPrendId = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'preInMsgLotId'
        def preInMsgLotId = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'preInMsgState'
        def preInMsgState = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'preInMsgPartPicNum'
        def preInMsgPartPicNum = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'preInMsgSaveCodeList'
        def preInMsgSaveCodeList = dynamicQueryService.queryForList(params)
        [preInMessage:preInMessage,tableHeadList:tableHeadList,preInMsgType:preInMsgType,pageSize:pageSize,
        partType:params.partType?:'',totalCount: totalCount,pageSizeList:pageSizeList,startno:params.startno?:'',endno:params.endno?:'',
         preInMsgPrendId:preInMsgPrendId,preInMsgLotId:preInMsgLotId,preInMsgState:preInMsgState,
        parentId:params.parentId?:'',lotId:params.lotId?:'',inState:params.inState?:'',startTime:params.startTime?:'',endTime:params.endTime?:'',
         preInMsgSaveCodeList:preInMsgSaveCodeList,preInMsgPartPicNum:preInMsgPartPicNum,partName:params.partName?:'',group4:params.group4?:'']

    }
}
